//
//  OneimageCell.m
//  Product_NEWS
//
//  Created by dllo on 16/1/7.
//  Copyright © 2016年 FCH. All rights reserved.
//

#import "OneimageCell.h"

@interface OneimageCell ()
@property (nonatomic, retain) BaseImageView *headImageView;
@property (nonatomic, retain) titleLabel *titleLabel;
@property (nonatomic, retain) WordTite *
contentLabel;
@property (nonatomic, retain) UILabel *ReadCount;
@end
@implementation OneimageCell

- (void)dealloc{
    [_headImageView release];
    [_titleLabel release];
    [_contentLabel release];
    [_listModel release];
    [_ReadCount release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
        
        
}
    return self;
}

- (void)createSubViews{
    self.headImageView = [[BaseImageView alloc] initWithFrame:CGRectMake(10 * SCREEN_WIDTH, 10* SCREEN_HEIGHT, 100* SCREEN_WIDTH, 75 * SCREEN_HEIGHT)];
    
    [self.contentView addSubview:self.headImageView];
    [_headImageView release];
    
    self.titleLabel = [[titleLabel alloc] initWithFrame:CGRectMake(130* SCREEN_WIDTH, 3* SCREEN_HEIGHT, 240* SCREEN_WIDTH, 50* SCREEN_HEIGHT)];
    self.titleLabel.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
    self.titleLabel.textColor = [NightModeHandle shareNightModeHandle].titleColor;
    self.titleLabel.font = [UIFont systemFontOfSize:15 * SCREEN_WIDTH];
   
    [self.contentView addSubview:self.titleLabel];
    [_titleLabel release];
    
    self.contentLabel = [[WordTite alloc] initWithFrame:CGRectMake(130* SCREEN_WIDTH, 40* SCREEN_HEIGHT, 240* SCREEN_WIDTH, 50* SCREEN_HEIGHT)];
    self.contentLabel.backgroundColor = [NightModeHandle shareNightModeHandle].allViewColor;
    self.contentLabel.textColor = [NightModeHandle shareNightModeHandle].wordColor;
    self.contentLabel.font = [UIFont systemFontOfSize:15 * SCREEN_WIDTH];
    self.contentLabel.numberOfLines = 0;
    [self.contentView addSubview:self.contentLabel];
    [_contentLabel release];
    
    self.ReadCount = [[UILabel alloc]initWithFrame:CGRectMake(310 * SCREEN_WIDTH, 70 * SCREEN_HEIGHT, 60* SCREEN_WIDTH, 20* SCREEN_HEIGHT)];
    self.ReadCount.textColor = [NightModeHandle shareNightModeHandle].wordColor;
    self.ReadCount.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:self.ReadCount];
    [_ReadCount release];
    
    
    UIImageView *footImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 102 * SCREEN_HEIGHT,  375 * SCREEN_WIDTH, 2 * SCREEN_HEIGHT)];
    footImageView.image = [UIImage imageNamed:@"mashup_shadow_bottom@2x.png"];

    
    
    [self addSubview:footImageView];
    [footImageView release];
    
}

-(void)setListModel:(NewsListModel *)listModel{

    if (_listModel != listModel) {
        [_listModel release];
        _listModel = [listModel retain];
    }
    self.titleLabel.text = _listModel.title;
    self.contentLabel.text = _listModel.digest;
    
    NSURL *url = [NSURL URLWithString:_listModel.imgsrc];
    [self.headImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"background"]];
    
    self.ReadCount.text = [self exchangeReply:_listModel.replyCount];
    
}







@end
